from peewee import *
from . import base, hydrology, hru_parm_db, soils, lum, init, decision_table, reservoir


class Hru_data_hru(base.BaseModel):
	name = CharField(unique=True)
	topo = ForeignKeyField(hydrology.Topography_hyd, null=True, on_delete='SET NULL')
	hydro = ForeignKeyField(hydrology.Hydrology_hyd, null=True, on_delete ='SET NULL')
	soil = ForeignKeyField(soils.Soils_sol, null=True, on_delete='SET NULL')
	lu_mgt = ForeignKeyField(lum.Landuse_lum, null=True, on_delete ='SET NULL')
	soil_plant_init = ForeignKeyField(init.Soil_plant_ini, null=True, on_delete='SET NULL')
	surf_stor = ForeignKeyField(reservoir.Wetland_wet, null=True, on_delete='SET NULL')
	snow = ForeignKeyField(hru_parm_db.Snow_sno, null=True, on_delete='SET NULL')
	field = ForeignKeyField(hydrology.Field_fld, null=True, on_delete='SET NULL')
	description = TextField(null=True)


class Hru_lte_hru(base.BaseModel):
	name = CharField(unique=True)
	area = DoubleField()
	cn2 = DoubleField()
	cn3_swf = DoubleField()
	t_conc = DoubleField()
	soil_dp = DoubleField()
	perc_co = DoubleField()
	slp = DoubleField()
	slp_len = DoubleField()
	et_co = DoubleField()
	aqu_sp_yld = DoubleField()
	alpha_bf = DoubleField()
	revap = DoubleField()
	rchg_dp = DoubleField()
	sw_init = DoubleField()
	aqu_init = DoubleField()
	aqu_sh_flo = DoubleField()
	aqu_dp_flo = DoubleField()
	snow_h2o = DoubleField()
	lat = DoubleField()
	soil_text = ForeignKeyField(soils.Soils_lte_sol, null=True, on_delete='SET NULL')
	trop_flag = CharField(default='non_trop')
	grow_start = ForeignKeyField(decision_table.D_table_dtl, null=True, on_delete='SET NULL')
	grow_end = ForeignKeyField(decision_table.D_table_dtl, null=True, on_delete='SET NULL')
	plnt_typ = ForeignKeyField(hru_parm_db.Plants_plt, null=True, on_delete='SET NULL')
	stress = DoubleField()
	pet_flag = CharField(default='harg')
	irr_flag = CharField(default='no_irr')
	irr_src = CharField(default='outside_bsn')
	t_drain = DoubleField()
	usle_k = DoubleField()
	usle_c = DoubleField()
	usle_p = DoubleField()
	usle_ls = DoubleField()
